/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.backlog.domain.db;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author Gleibson Oliveira
 */
@Entity
public class Task implements Serializable{

    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
    private String description;
    private double plannedHours;
    private TaskStatus status;

    @ManyToOne
    @JoinColumn(name="SPRINT_ID", nullable=false)
    private Sprint sprint;

    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinColumn(name="TASK_ID", nullable=false)
    private List<Report> report;
    
    //TODO incluir data de criação
    
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getPlannedHours() {
        return plannedHours;
    }

    public void setPlannedHours(double plannedHours) {
        this.plannedHours = plannedHours;
    }

    public Sprint getSprint() {
        return sprint;
    }

    public void setSprint(Sprint sprint) {
        this.sprint = sprint;
    }

    public List<Report> getReport() {
        return report;
    }

    public void setReport(List<Report> taskReport) {
        this.report = taskReport;
    }

    public TaskStatus getStatus() {
        return status;
    }

    public void setStatus(TaskStatus status) {
        this.status = status;
    }

    

}
